package lines.gameengine.util;

import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

/**
 * @author vpotapenko
 */
public class DefaultScoreHolderTest {

    private DefaultScoreHolder holder;

    @Before
    public void setUp() throws Exception {
        holder = new DefaultScoreHolder();
    }

    @Test public void shouldAddToScoreOnClearBalls() {
        holder.dispatchClearBalls(5);
        assertThat(holder.getScore(), equalTo(5));

        holder.dispatchClearBalls(1);
        assertThat(holder.getScore(), equalTo(6));
    }

    @Test public void shouldResetScore() {
        holder.dispatchClearBalls(10);
        assertThat(holder.getScore(), equalTo(10));

        holder.reset();
        assertThat(holder.getScore(), equalTo(0));
    }
}
